package com.sky.mapper.common;

import com.sky.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

public interface UserMapper {

    @Select("select * from user where openid = #{openId}")
    User selectByOpenId(String openId);

    void insert(User user);

    @Select("select * from user where id = #{userId}")
    User selectById(Long userId);

    @Select("select count(*) from user where create_time < #{beginTime}")
    int countUserLTBeginTime(String beginTime);

    Map<String, Object> countIncrByDays(@Param("beginTime") String beginTime,
                                        @Param("end") LocalDate end,
                                        @Param("dateList") List<String> dateList);


    Map<String, Object> selectEveryDayNewUserTotalByDate(@Param("begin") String oldBegin,
                                                         @Param("end") String oldEnd,
                                                         @Param("list") List<String> dateList);
}
